package com.umgsai.thread.thread22;

public class PrintString {
	private boolean isContinuePrint = true;
	public boolean isContinuePrint() {
		return isContinuePrint;
	}
	public void setContinuePrint(boolean isContinuePrint) {
		this.isContinuePrint = isContinuePrint;
	}
	public void printStringMethod() {
		try {
			while (isContinuePrint) {
				System.out.println("printStringMethod is running...threadName=" + Thread.currentThread().getName());
				Thread.sleep(1000);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		PrintString printString = new PrintString();
		printString.printStringMethod();//死循环。。。
		System.out.println("停止线程...");
		printString.setContinuePrint(false);
	}
}
